<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>网易云音乐年终总结h5</title>
     <!-- 使用link标签引入swiper.min.css样式 ()-->
     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/css/swiper.min.css">
    <!-- 使用link标签引入./common.css样式 -->
    <link rel="stylesheet" href="./common.css">
   
    <style>
        *{
            margin: 0; 
            padding: 0;
        }/*清除默认样式*/
 
        /* .box{
            width:375;
            height:375px;
            background-color:red;
        } */
    </style>
</head>
<body>
    <!-- 再次引入swiper.min.css样式的js文件 -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.0.2/js/swiper.min.js"></script>
    <!-- audio不会占用文档流 -->
    <audio id="j-bgm" src="./bgm.mp3"></audio>
    <div class="next-view-c"></div>
    <!-- 音乐播放与关闭  -->
    <div class="music-btn off"></div>
    <!-- 滑页操作 -->
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"></div>
                <div class="view index">
                    <div class="logo-c"></div>
                </div>           
            <div class="swiper-slide"></div>                      
        </div>
    </div>
    <script>
        //1.实现音乐的播放与关闭

        //dom操作
        const audio =document.getElementById('j-bgm');
        const musicBtn =document.querySelector('.music-btn');
        const isMusicPause = true;
        //js是基于事件驱动的语言,当我们点击的时候才会触发事件
        musicBtn.addEventListener('click',function(){
            // if(true){
            //     audio.play();
            //     isMusicPause = false;
            // }else{
            //     audio.pause();
            //     isMusicPause = true;
            // }
            if(audio.paused){
                audio.play();
            }else{
                audio.pause();
            }
            musicBtn.classList.toggle('off') //切换样式 .music-btn to off
        })

        //2.实现滑页操作
        new Swiper('.swiper-container',{
            direction:'vertical'//垂直滑页
        })

    </script>
</body>
</html>